FILE(GLOB TESTS_SRCS test-*.cpp)

MESSAGE( STATUS "Sources: ${TESTS_SRCS}" )

ENABLE_TESTING()

SET(TESTS)

FOREACH(fn IN LISTS TESTS_SRCS )
	GET_FILENAME_COMPONENT(fx ${fn} NAME_WE)
	MESSAGE( STATUS "****** ${fx}" )
	ADD_EXECUTABLE( ${fx} ${fn} )
	TARGET_LINK_LIBRARIES( ${fx} wink pyck )
	IF( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" )
		TARGET_LINK_LIBRARIES( ${fx} pthread rt)
	ENDIF()
	ADD_TEST( "run-${fx}" ${fx} )
	LIST(APPEND TESTS ${fx} )
ENDFOREACH(fn)

ADD_CUSTOM_TARGET(check-wink COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS ${TESTS})
